package cn.wolfcode.trip.base.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**tiger
 * 订单
 */
@Setter@Getter
public class ProductOrder extends BaseDomain{

    public static final Integer FREIGHT_NOPAY = 0; //未支付
    public static final Integer FREIGHT_ALREADYPAY = 1; //已支付待收货
    public static final Integer FREIGHT_FINISH= 2; //已支付待收货

    //订单编号
    private String sequence;
    //用户
    private User user;
    //收货地址
    private String add;
    //支付方式
    private Integer payWay;
    //留言
    private String message;
    //状态
    private Integer freight =FREIGHT_NOPAY;
    private Double totalPrices;
    //商品
    private List<Product> product=new ArrayList<>();
    //规格
    private List<ProductSpecs> productSpecs=new ArrayList<>();
    //地址
    private Add addressName;

    //商品
    private List<Product> products = new ArrayList<>();

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone = "GMT+8")
    private Date createTime;

    public String getState(){
        String state="未支付";
        if (freight.equals(FREIGHT_ALREADYPAY)) {
            state="待收货";

        }else if (freight.equals(FREIGHT_FINISH)){
            state="待评价";
        }
        return state;
    }
}